package com.bean.library;

import java.util.Date;

public class Student {
	private String studentId;
	private String password;
	private String stuName;
	private String academy;
	private String major;
	private String yearOfEntrance;
	
	public Student( String studentId,
			String stuName,
			String academy,
			String major,
			String yearOfEntrance){
		this.studentId = studentId;
		this.stuName = stuName;
		this.academy = academy;
		this.major = major;
		this.yearOfEntrance = yearOfEntrance;
	}
	public Student( String studentId,
			String stuName,
			String password,
			String academy,
			String major,
			String yearOfEntrance){
		this.studentId = studentId;
		this.stuName = stuName;
		this.password = password;
		this.academy = academy;
		this.major = major;
		this.yearOfEntrance = yearOfEntrance;
	}
	public Student(){
		
	}
	public String getStudentId() {
		return studentId;
	}
	public void setStudentId(String studentId) {
		this.studentId = studentId;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getStuName() {
		return stuName;
	}
	public void setStuName(String stuName) {
		this.stuName = stuName;
	}
	public String getAcademy() {
		return academy;
	}
	public void setAcademy(String academy) {
		this.academy = academy;
	}
	public String getMajor() {
		return major;
	}
	public void setMajor(String major) {
		this.major = major;
	}
	public String getYearOfEntrance() {
		return yearOfEntrance;
	}
	public void setYearOfEntrance(String yearOfEntrance) {
		this.yearOfEntrance = yearOfEntrance;
	}
	public int getGrade(){//学生的年级，根据入学年份判断
		int grade = 1;
		int enterYear = Integer.valueOf(this.yearOfEntrance);
		Date dateNow = new Date();
		Date dateEnterSchool = new Date(enterYear-1900,9,1);
		for(;grade<7;grade++){
			int month = dateEnterSchool.getMonth();
			dateEnterSchool.setMonth(month+6);
			if(dateNow.before(dateEnterSchool)){
				break;
			}
		}
		return grade;
	}
}
